package sbt;

import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.testng.*;
import org.testng.annotations.*;

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

import sbt.model.Film;
import sbt.model.User;

public class RemoveFilm extends sbt.pages.TestBase {
	public Film film;
  
  @BeforeClass
  public void testLogin() {
	  	User user = new User().setLogin("admin").setPassword("admin");
	  	app.getUserHelper().loginAs(user);
	  }

  @BeforeMethod
  public void AddFilm() throws Exception {
		String filmname = "Delete Film";
		String filmyear = "2013";
		film = new Film().setTitle(filmname).setYear(filmyear );
		app.getFilmHelper().create(film);

  }

  @Test
  public void testRemoveFilm() throws Exception {
	app.getFilmHelper().delete();
    assertTrue(app.getNavigationHelper().isMainPage());
  }
  @AfterClass
  public void testLogout(){
		app.getUserHelper().logout();
  }
}
